<?php
/**
 * @function：接口统一层。微信公众平台调用本接口，调试也调用本接口
 * @Author: 倪银龙
 * @Mail niyinlong@126.com
 * @Date: 15-10-1
 * @Time: 上午9:00
 * @Blog: Http://www.thinkwechat.cn
 */
namespace Org\Wechat;
use Org\Wechat\message;
use Org\Wechat\response;
use Org\Wechat\text;
use Org\Wechat\location;
use Org\Wechat\event;
use Org\Wechat\image;
use Org\Wechat\voice;
use Org\Wechat\video;
use Org\Wechat\shortvideo;
/**
 * 微信公众账号的接口层，微信响应调用该接口，调试也调用此接口
 */
class api{
    private $msg = null;
    //构造函数
    function __construct($msg) {
        $this->msg = $msg;
    }
    //文本信息处理函数。
    public function Text_deal(){      	
         $tool = new text();
         return $tool->getResponse($this->msg->fromUsername,$this->msg->toUsername,$this->msg->keyword);
    }
    //地理信息的处理函数。
    public function Location_deal(){       
        $tool = new location();
        return $tool->getResponse($this->msg->fromUsername,$this->msg->toUsername,$this->msg->lat_x,$this->msg->lng_y,$this->msg->Label);
    }
    //事件处理函数。
    public function Event_deal(){        
        $tool = new event();
        return $tool->getResponse($this->msg->fromUsername,$this->msg->toUsername,$this->msg->event_type,$this->msg->event_key);
    }    
    //图片信息处理
    public function Image_deal(){       
        $tool = new image();
        return $tool->getResponse($this->msg->fromUsername,$this->msg->toUsername,$this->msg->PicUrl,$this->msg->MediaId);
    }
    //声音信息处理
    public function Voice_deal(){      
        $tool = new voice();
        return $tool->getResponse($this->msg->fromUsername,$this->msg->toUsername,$this->msg->Format,$this->msg->MediaId,$this->msg->Recognition);
    }
    //视频信息处理
    public function Video_deal(){      
        $tool = new video();
        return $tool->getResponse($this->msg->fromUsername,$this->msg->toUsername,$this->msg->ThumbMediaId,$this->msg->MediaId);
    }
    //短视频信息处理
    public function ShortVideo_deal(){       
        $tool = new shortvideo();
        return $tool->getResponse($this->msg->fromUsername,$this->msg->toUsername,$this->msg->ThumbMediaId,$this->msg->MediaId);
    }
}